package com.example.vertification.service;

import com.example.vertification.Utils.RedisUtil;
import com.example.vertification.entity.ChatMessage;
import com.example.vertification.entity.PageEntity;
import com.example.vertification.entity.User;
import com.example.vertification.repository.ChatRepository;
import com.example.vertification.repository.PageRepository;
import com.example.vertification.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class PageService {

    @Autowired
    private RedisUtil redisUtil;

    private final PageRepository pageRepository;

    @Autowired
    public PageService(PageRepository pageRepository) {
        this.pageRepository = pageRepository;
    }

    public PageEntity getPage(long pageID) {
        return pageRepository.findByPageId(pageID);
    }


    public List<PageEntity> getAllPage() {
        return pageRepository.findAll();
    }

    public Page<PageEntity> getPageByPageable(Pageable p) {
        return pageRepository.findAll(p);
    }
    public PageEntity savePageEntity(PageEntity e) {
        return pageRepository.save(e);
    }


}